#ifndef WIDGET_H
#define WIDGET_H
#include <QTimer>
#include <QWidget>
#include <QPainter>
#include <QKeyEvent>
#include "map.h"
#include "heroplane.h"
#include "bullet.h"
#include "enemyplane.h"
#include "star.h"

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void initScene();
    void playgame();
    void updateposition();
    void paintEvent(QPaintEvent*);
    void enemytoscene();
    void collisiondetection();
    void startoscene();

    enemyplane m_enemys[EMENY_NUM];
    int m_recorder;
    map m_map;
    QTimer m_Timer;
    heroplane m_hero;
    bullet temp_bullet;
    int m_score;
    star m_stars[STAR_NUM];
    int m_star_recorder;
    int m_star_count;

protected:
    void keyPressEvent(QKeyEvent *event) override;
};

#endif // WIDGET_H
